package chapter_8;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class Test4 {

    public static void main(String[] args) {

        List<Son2> list = new ArrayList<>();
        List<Sun> sunList = null;
        List<String> strList = null;
        List<Object> objList = null;
        Collection  c = new ArrayList();
        Iterator iterator = c.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
        }
        for (Object o : c) {
            if(o instanceof  String){
                String str =(String) o;
            }else if(o instanceof  Boolean){

            }else if(o instanceof  Son){

            }
        }
        Collection<String>  cc = new ArrayList();
        Iterator<String> iterator1 = cc.iterator();
        while(iterator1.hasNext()){
            String next = iterator1.next();
        }
        for (String s : cc) {

        }

//        print(list);
//        print(sunList);
//        print(strList);
//        print2(list);
//        print2(sunList);
//        print2(objList);
//        print3(list);
//        print3(sunList);
//        print3(objList);
//        print3(strList);
    }
    public static void print3(List<?> t)
    {
        System.out.println(t);
    }
    public static  void print2(List<? super Son2> t)
    {
        System.out.println(t);
    }
    public static  void print(List<? extends Son2> t)
    {
        System.out.println(t);
    }
}
